package com.zking.ssm.service.impl;

import com.zking.ssm.mapper.NewsMapper;
import com.zking.ssm.model.News;
import com.zking.ssm.service.INewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class NewsServiceImpl implements INewsService {

    @Resource
    private NewsMapper newsMapper;

    @Override
    public int grantCategory(News news) {
        newsMapper.insert(news);
        return newsMapper.grantCategory(news);
    }

    @Override
    public int revokeCategory(News news) {
        return newsMapper.revokeCategory(news);
    }

    @Override
    public int deleteByPrimaryKey(Integer newsId) {
        newsMapper.deleteByNewsId(newsId);
        return newsMapper.deleteByPrimaryKey(newsId);
    }

    @Override
    public List<News> listNews(News news) {
        return newsMapper.listNews(news);
    }
}
